package com.jhm.bing_fa_rong_qi;
import java.util.concurrent.ConcurrentHashMap;
public class ConcurrentHashMapDemo {
    public static void main(String[] args) throws Exception {
        //线程安全的ConcurrentHashMap并发集合
        ConcurrentHashMap<Integer,String> concurrentHashMap = new ConcurrentHashMap<>();
        for(int i=0;i<100;i++){
            int ii=i;
            new Thread(()->{
                for(int j=0;j<100;j++){
                    concurrentHashMap.put(ii*100+j,"haha");
                }
            }).start();
        }
        Thread.sleep(2000);
        System.out.println(concurrentHashMap.size());
    }
}
